package com.cqc.web;

import com.cqc.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * http://localhost:8080/SwaggerDemo/swagger-ui.html
 */
@Api(value = "用户的操作类")
@RestController
public class SwaggerController {

    /**
     * http://localhost:8080/SwaggerDemo/selectUser.do
     * @param user
     * @return
     */
    @ApiOperation(value = "查找用户")
    @RequestMapping(value = "/selectUser" ,method = RequestMethod.POST)
    @ResponseBody
    public User selectUser(User user){
        User user1=new User();
        user1.setUsername("特朗普");
        user1.setAge(80);
        return user1;
    }

    /**
     * http://localhost:8080/SwaggerDemo/deleteUserByName.do
     * @param username
     * @return
     */
    @ApiOperation(value = "删除用户")
    @RequestMapping(value = "/deleteUserByName" ,method = RequestMethod.GET)
    @ResponseBody
    public User deleteUserByName( String  username){
        User user1=new User();
        user1.setUsername(username);
        user1.setAge(60);
        return user1;
    }



}
